package com.example.controller;

import com.example.pojo.Result;
import com.example.pojo.suspectListPojo;
import com.example.service.suspectListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * ClassName:suspectListController
 * Description:
 *
 * @Author 赵永峰
 * @Create 2024/10/5 0:17
 * @Version 1.0
 */
@RestController
public class suspectListController {
    @Autowired
    private suspectListService suspectListService;
    //插入一行数据
    @PostMapping("/suspectProductInsertOne")
    public Result suspectProductInsertOne(@RequestBody suspectListPojo suspectListPojo){
        suspectListPojo listPojo=suspectListService.insertOne(suspectListPojo);
        return Result.success(listPojo);
    }
    //查询所有数据
    @PostMapping("/suspectSelectAll")
    public Result selectAll(){
        List<suspectListPojo> suspectListPojos=suspectListService.selectAll();
        return Result.success(suspectListPojos) ;
    }
    //根据id，修改一个字段的值
    @PostMapping("/suspectEditOneFiledById")
    public Result suspectEditOneFiledById(@RequestBody Map<String,Object> map){
        suspectListService.EditOneFiledById(map);
        return Result.success();
    }
    //根据id，修改一行的数据，用在了对大表修改上
    @PostMapping("/suspectProductEditOne")
    public Result suspectProductEditOne(@RequestBody suspectListPojo suspectListPojo){
        suspectListService.EditFiledById(suspectListPojo);
        return Result.success();
    }
}
